<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="custom" tagdir="/WEB-INF/tags" %>

<div class="modal-header">
    <button type="button" class="close"
            data-dismiss="modal" aria-hidden="true">
        &times;
    </button>
    <h4 class="modal-title" id="myModalLabel">
        位置描述
    </h4>
</div>
<div class="modal-body">
    <form:form cssClass="form-horizontal form-bordered">
        <div class="panel panel-default">
            <div class="panel-body panel-body-nopadding">
                <div class="form-group">
                    <label class="col-sm-2 control-label">地址描述:</label>

                    <div class="col-sm-10">
                        <p class="form-control-static">
                                ${caseDto.addressDescription}
                        </p>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">定位地址:</label>

                    <div class="col-sm-10">
                        <c:if test="${not empty caseDto.locationX}">
                            <div id="mapWapper" style="width:100%;height:400px;"></div>
                        </c:if>
                        <c:if test="${empty caseDto.locationX}">
                            <p class="form-control-static"> 无经纬度信息 </p>
                        </c:if>
                    </div>
                </div>
            </div>
        </div>
    </form:form>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
    </button>
</div>
<script type="text/javascript">
    function initMap() {
// 百度地图API功能
        var map = new BMap.Map("mapWapper");
        var point = new BMap.Point('${caseDto.locationX}', '${caseDto.locationY}');
        map.centerAndZoom(point, 15);

        var marker = new BMap.Marker(point); // 创建点

        var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
        var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
        map.addControl(top_left_control);
        map.addControl(top_left_navigation);
        map.addOverlay(marker);
    }
    setTimeout(initMap, 200);
</script>